package com.example.project.controller;

import com.example.project.base.BaseApi;
import com.example.project.base.ResultBean;
import com.example.project.entity.TPostType;
import com.example.project.service.TPostTypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/tposttype")
@Api(value = "PostTypeController",tags = "岗位类型相关")
public class TPostTypeController extends BaseApi {
    @Autowired
    TPostTypeService tPostTypeService;

    @RequestMapping(value = "/getAllPostType",method = RequestMethod.POST)
    @ApiOperation("获取所有岗位类别")
    public ResultBean getAllPostType(Integer pageNo,Integer pageSize){
        try{
//            ShiroCacheObj shiroCacheObj=currAdminInfo();
            PageHelper.startPage(pageNo==null?0:pageNo,pageSize==null?0:pageSize);
            PageInfo<TPostType> info=new PageInfo<>(tPostTypeService.queryAll());
            return ok("成功",info);
        }catch (Exception e){
            e.printStackTrace();
            return fail("查询失败");
        }
    }
}
